package com.cssy.xxkj.logic.dao.impl;

import java.util.List;
import java.util.Map;

import org.springframework.dao.DataAccessException;
import org.springframework.orm.ibatis.support.SqlMapClientDaoSupport;

import com.cssy.xxkj.logic.dao.LogicProductionStorageinItemDAO;
import com.cssy.xxkj.logic.entity.LogicProductionStorageinItemDO;
import com.plat.helper.SearchConditions;

/**
 * 数据访问对象实现类
 * @since 2014-10-09
 */
public class LogicProductionStorageinItemDAOImpl extends SqlMapClientDaoSupport implements LogicProductionStorageinItemDAO {

    /**
     * 插入数据
     * @param logicProductionStorageinItemDO
     * @return 插入数据的主键
     */
    public String insertLogicProductionStorageinItemDO(LogicProductionStorageinItemDO logicProductionStorageinItemDO) throws DataAccessException {
        Object id = getSqlMapClientTemplate().insert("LogicProductionStorageinItem.insert", logicProductionStorageinItemDO);
        return (String) id;
    }

    /**
     * 统计记录数
     * @param logicProductionStorageinItemDO
     * @return 查出的记录数
     */
    public Integer countLogicProductionStorageinItemDOByExample(LogicProductionStorageinItemDO logicProductionStorageinItemDO) throws DataAccessException {
        Integer count = (Integer) getSqlMapClientTemplate().queryForObject("LogicProductionStorageinItem.countByDOExample", logicProductionStorageinItemDO);
        return count;
    }

    /**
     * 更新记录
     * @param logicProductionStorageinItemDO
     * @return 受影响的行数
     */
    public Integer updateLogicProductionStorageinItemDO(LogicProductionStorageinItemDO logicProductionStorageinItemDO) throws DataAccessException {
        int result = getSqlMapClientTemplate().update("LogicProductionStorageinItem.update", logicProductionStorageinItemDO);
        return result;
    }

    /**
     * 获取对象列表
     * @param logicProductionStorageinItemDO
     * @return 对象列表
     */
    @SuppressWarnings("unchecked")
    public List<LogicProductionStorageinItemDO> findListByExample(LogicProductionStorageinItemDO logicProductionStorageinItemDO) throws DataAccessException {
        List<LogicProductionStorageinItemDO> list = getSqlMapClientTemplate().queryForList("LogicProductionStorageinItem.findListByDO", logicProductionStorageinItemDO);
        return list;
    }
    
    public List<LogicProductionStorageinItemDO> findListByMap(Map<String, Object> paramMap)throws DataAccessException{
    	List<LogicProductionStorageinItemDO> list = getSqlMapClientTemplate().queryForList("LogicProductionStorageinItem_ex.findListByMap", paramMap);
        return list;
    }

    /**
     * 根据主键获取logicProductionStorageinItemDO
     * @param id
     * @return logicProductionStorageinItemDO
     */
    public LogicProductionStorageinItemDO findLogicProductionStorageinItemDOByPrimaryKey(String id) throws DataAccessException {
        LogicProductionStorageinItemDO logicProductionStorageinItemDO = (LogicProductionStorageinItemDO) getSqlMapClientTemplate().queryForObject("LogicProductionStorageinItem.findByPrimaryKey", id);
        return logicProductionStorageinItemDO;
    }

    /**
     * 删除记录
     * @param id
     * @return 受影响的行数
     */
    public Integer deleteLogicProductionStorageinItemDOByPrimaryKey(String id) throws DataAccessException {
        Integer rows = (Integer) getSqlMapClientTemplate().delete("LogicProductionStorageinItem.deleteByPrimaryKey", id);
        return rows;
    }

	@Override
	public List<LogicProductionStorageinItemDO> find(SearchConditions scs)
			throws DataAccessException {
		List<LogicProductionStorageinItemDO> list = getSqlMapClientTemplate().queryForList("LogicProductionStorageinItem_ex.find", scs);
        return list;
	}

	@Override
	public Integer count(SearchConditions scs) throws DataAccessException {
		Integer count = (Integer) getSqlMapClientTemplate().queryForObject("LogicProductionStorageinItem_ex.count", scs);
        return count;
	}

	@Override
	public Integer deleteBizRemoved(String id) throws DataAccessException {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public Integer deleteProById(String id) throws DataAccessException {
		Integer rows = (Integer) getSqlMapClientTemplate().delete("LogicProductionStorageinItem_ex.deleteProById", id);
        return rows;
	}

}